import request from '@/utils/request'

const baseURL = '/api/schedule'

export function getAllScheduleList() {
  return request({
    url: baseURL + '/allScheduleList',
    method: 'get'
  })
}

export function getScheduleList({
                              page, pageSize, params = {}, data
                            }) {
  return request({
    url: baseURL + '/list',
    method: 'post',
    params: {
      page, pageSize,
      ...params
    }, data
  })
}

export function getOneSchedule(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'get'
  })
}

export function addSchedule(data) {
  return request({
    url: baseURL,
    method: 'post',
    data
  })
}

export function updateSchedule(id, data) {
  return request({
    url: baseURL + `/${id}`,
    method: 'put',
    data
  })
}

export function deleteOneSchedule(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'delete'
  })
}

export function getScheduleSimpleList() {
  return request({
    url: baseURL + '/simpleList',
    method: 'get'
  })
}

export function arrange(year, semester, data) {
  return request({
    url: baseURL + `/arrange/${year}/${semester}`,
    method: 'post',
    data
  })
}
